/*
 *  $Id: Imprison.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Darkness.Spells {
    public class Imprison: TargetEnchantmentCard<Creature> {
        public Imprison(): base("001_d_s_imprison") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Darkness;
            Value = 100;
            Target = new CreatureTarget(CreatureTarget.Enemy.Notice, false, true, IsManaEnough);
            AddManaCost(ElementType.Darkness, 1);
        }

        private static bool IsManaEnough(TargetRequest request, Creature creature) {
            int cur = request.Player.GetMana(ElementType.Darkness);
            int req = creature.Card.GetSumMana();
            return cur > req;
        }

        protected override void DoAction(TargetArgs<Creature> args) {
            int mana = args.Target.Card.GetSumMana();
            args.Player.DecrementMana(ElementType.Darkness, mana);
            base.DoAction(args);
        }
        protected override EnchantmentAffect CreateEnchantment() {
            return new ImprisonAffect();
        }

        private class ImprisonAffect: EnchantmentAffect<Imprison> {
            public ImprisonAffect() {
                Add(new Affects.Paralysis(5));
            }
        }
    }
}
